package com.scut.edu.wanyou.util;




import android.util.Log;

import com.alibaba.fastjson.JSON;  


public class JsonHandler {
	@SuppressWarnings("rawtypes")  
	public static String serialize(Object object)
	{
		String jsonStr = "";
		try {
			//jsonValue = JSONMapper.toJSON(object.getClass());
			//jsonStr = jsonValue.render(true); // 是否格式化
			jsonStr = JSON.toJSONString(object);
		}catch(Exception e)
		{
			Log.e("JsonHandler.java",e.getMessage());
		}
        return jsonStr;
	}
	
	@SuppressWarnings("rawtypes")
	public static Object parseJson(String str,Object object)
	{
		object = JSON.parseObject(str, object.getClass());
        return object;
	}
	
}
